package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.PingjiaBean;
import com.lwj.liwanjia.impl.PingjiaView;
import com.lwj.liwanjia.model.PingjiaModel;

import java.io.File;
import java.util.List;
import java.util.Map;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/22.
 */

public class PingjiaPresenter {
    private PingjiaView pingjiaView;
    private PingjiaModel pingjiaModel;

    public PingjiaPresenter(PingjiaView pingjiaView) {
        this.pingjiaView = pingjiaView;
        pingjiaModel = new PingjiaModel();
    }

    public void pingjiaIndent(Map<String, Object> map, List<File> files) {
        if (pingjiaView != null) {
            pingjiaModel.pingjiaIndent(map, files, new Subscriber<PingjiaBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    pingjiaView.showError((Exception) e);
                }

                @Override
                public void onNext(PingjiaBean pingjiaBean) {
                    pingjiaView.pingjiaIndent(pingjiaBean);
                }
            });
        }
    }
}
